Method and system for lossless value-location encoding

ABSTRACT

A method of encoding samples in a digital signal is provided that includes receiving a frame of N samples of the digital signal, determining L possible distinct data values in the N samples, determining a reference data value in the L possible distinct data values and a coding order of L−1 remaining possible distinct data values, wherein each of the L−1 remaining possible distinct data values is mapped to a position in the coding order, decomposing the N samples into L−1 coding vectors based on the coding order, wherein each coding vector identifies the locations of one of the L−1 remaining possible distinct data values in the N samples, and encoding the L−1 coding vectors.

CROSS-REFERENCE TO RELATED APPLICATIONS

This application claims benefit of U.S. Provisional Patent ApplicationSer. No. 61/218,307, filed Jun. 18, 2009, U.S. Provisional PatentApplication Ser. No. 61/219,198, filed Jun. 22, 2009, and U.S.Provisional Patent Application Ser. No. 61/219,868, filed Jun. 24, 2009,which are incorporated herein by reference in their entirety.

BACKGROUND OF THE INVENTION

In many signal processing applications, it is desirable to transmitand/or store a digitized signal such that the exact original signal maybe recovered. It is also desirable to reduce the number of bits neededto represent the signal in order to maximize the amount of data than canbe handled during the transmission and/or storage process. Losslesscompression techniques may be used to achieve this goal. Many techniquesexist for lossless compression including Huffman coding, run-lengthcoding, and predictive coding. Each of these coding techniques mayprovide comparatively better compression for certain classes of signals.However, improvements in lossless compression of digital signals aredesirable.

Further, in many cases, digital signals to be encoded and transmittedinclude one predominant sample value, with sparse excursions to a fewother sample values. For example, background noise in digital audiosignals will often have a few distinct sample values. Signals with thissample characteristic are often not conducive to efficient encoding byknown encoding techniques, such as linear predictive coding. When datato be transmitted includes predominantly one sample value, with sparseexcursions to a single additional sample value, a run-length codingtechnique may be used. However, if sparse excursions occur to more thanone other value, the typical run-length coding techniques may not beefficient, since such techniques may be most effective in encodingdigital signals having sequences of one predominant sample value with asingle other sample value sparsely included.

BRIEF DESCRIPTION OF THE DRAWINGS

Particular embodiments in accordance with the invention will now bedescribed, by way of example only, and with reference to theaccompanying drawings:

FIG. 1 shows a block diagram of a digital system in accordance with oneor more embodiments of the invention;

FIG. 2 shows a flow diagram of a method in accordance with one or moreembodiments of the invention;

FIGS. 3A-3E and 4A-4D show examples in accordance with one or moreembodiments of the invention;

FIG. 5 shows a block diagram of an audio encoder in accordance with oneor more embodiments of the invention; and

FIG. 6 shows an illustrative digital system in accordance with one ormore embodiments of the invention.

DETAILED DESCRIPTION OF EMBODIMENTS OF THE INVENTION

Specific embodiments of the invention will now be described in detailwith reference to the accompanying figures. Like elements in the variousfigures are denoted by like reference numerals for consistency.

Certain terms are used throughout the following description and theclaims to refer to particular system components. As one skilled in theart will appreciate, components in digital systems may be referred to bydifferent names and/or may be combined in ways not shown herein withoutdeparting from the described functionality. This document does notintend to distinguish between components that differ in name but notfunction. In the following discussion and in the claims, the terms“including” and “comprising” are used in an open-ended fashion, and thusshould be interpreted to mean “including, but not limited to . . . .”Also, the term “couple” and derivatives thereof are intended to mean anindirect, direct, optical, and/or wireless electrical connection. Thus,if a first device couples to a second device, that connection may bethrough a direct electrical connection, through an indirect electricalconnection via other devices and connections, through an opticalelectrical connection, and/or through a wireless electrical connection.

In the following detailed description of embodiments of the invention,numerous specific details are set forth in order to provide a morethorough understanding of the invention. However, it will be apparent toone of ordinary skill in the art that the invention may be practicedwithout these specific details. In other instances, well-known featureshave not been described in detail to avoid unnecessarily complicatingthe description. In addition, although method steps may be presented anddescribed herein in a sequential fashion, one or more of the steps shownand described may be omitted, repeated, performed concurrently, and/orperformed in a different order than the order shown in the figuresand/or described herein. Accordingly, embodiments of the inventionshould not be considered limited to the specific ordering of steps shownin the figures and/or described herein. Further, while some embodimentsof the invention are described herein in reference to the ITU-T G.711.0standard and/or audio signals, one of ordinary skill in the art willunderstand that embodiments of the invention are not limited to anyparticular signal coding standard or type of signal. RecommendationITU-T G.711.0 (“ITU-T G.711.0”) as approved on Sep. 22, 2009 by ITU-TStudy Group 16 is incorporated by reference herein in its entirety.

In general, embodiments of the invention provide for losslessvalue-location encoding of a digital signal in which the locations ofoccurrences of each possible distinct sample value in the digital signalare encoded. More specifically, in one or more embodiments of theinvention, a frame of N samples with L possible distinct data values isdecomposed into L−1 coding vectors where each coding vector representsthe locations of one of L−1 of the possible distinct data values in theframe. The decomposition is performed by determining a reference datavalue in the L possible distinct data values, determining a coding orderof the L−1 remaining possible distinct data values, and generating theL−1 coding vectors according to the coding order. Each of the codingvectors is then encoded in the order of generation and inserted into theoutput bit stream. Indicator(s) of the reference data value and thecoding order may also be encoded and inserted in the output bit stream.

FIG. 1 shows a block diagram of a digital system in accordance with oneor more embodiments of the invention. The digital system is configuredto perform coding of digital audio sequences using embodiments of themethods described herein. The system includes a source digital system(100) that transmits encoded digital audio sequences to a destinationdigital system (102) via a communication channel (116). The sourcedigital system (100) includes an audio capture component (104), an audioencoder component (106) and a transmitter component (108). The audiocapture component (104) is configured to provide an audio sequence to beencoded by the audio encoder component (106). The audio capturecomponent (104) may be, for example, a microphone, a speech synthesizer,an audio archive, or an audio feed from an audio content provider.

The audio encoder component (106) receives an audio sequence from theaudio capture component (104) and encodes it for transmission by thetransmitter component (108). In general, the audio encoder component(106) receives the audio sequence from the audio capture component (104)as a sequence of frames and encodes the audio data in each frame fortransmission. During the encoding process, a method for losslessvalue-location encoding in accordance with one or more of theembodiments described herein may be used. The functionality of anembodiment of the audio encoder component (106) is described in moredetail below in reference to FIG. 5.

The transmitter component (108) transmits the encoded audio data to thedestination digital system (102) via the communication channel (116).The communication channel (116) may be any communication medium, orcombination of communication media suitable for transmission of theencoded audio sequence, such as, for example, wired or wirelesscommunication media, a local area network, and/or a wide area network.

The destination digital system (102) includes a receiver component(110), an audio decoder component (112) and a speaker component (114).The receiver component (110) receives the encoded audio data from thesource digital system (100) via the communication channel (116) andprovides the encoded audio data to the audio decoder component (112) fordecoding. In general, the audio decoder component (112) reverses theencoding process performed by the audio encoder component (106) toreconstruct the frames of the audio sequence. The reconstructed audiosequence may then be reproduced by the speaker component (114). Thespeaker component (114) may be any suitable audio reproduction device.

In some embodiments of the invention, the source digital system (100)may also include a receiver component and an audio decoder componentand/or the destination digital system (102) may include a transmittercomponent and an audio encoder component for transmission of audiosequences in both directions. Further, the audio encoder component (106)and the audio decoder component (112) may perform encoding and decodingin accordance with one or more audio compression standards such as, forexample, ITU-T G.711 and G.711.0 standards. The audio encoder component(106) and the audio decoder component (112) may be implemented in anysuitable combination of software, firmware, and hardware, such as, forexample, one or more digital signal processors (DSPs), microprocessors,discrete logic, application specific integrated circuits (ASICs),field-programmable gate arrays (FPGAs), etc. Software implementing allor part of the audio encoder and/or audio decoder may be stored in amemory, e.g., internal and/or external ROM and/or RAM, and executed by asuitable instruction execution system, e.g., a microprocessor or DSP.Analog-to-digital converters and digital-to-analog converters mayprovide coupling to the real world, modulators and demodulators (plusantennas for air interfaces) may provide coupling for transmissionwaveforms, and packetizers may be included to provide formats fortransmission.

FIG. 2 shows a flow diagram of a method for lossless value-locationcoding of one or more frames of N samples in a digital signal inaccordance with one or more embodiments of the invention. As shown inFIG. 2, initially, a frame of N samples, I₀ to I_(N-1), of the digitalsignal is received (200). The value of N may be any suitable value. Forexample, N may be 40, 80, 160, 240, or 320.

Next, the L possible distinct data values that the N samples may bedetermined (202). The possible distinct data values in the N samples maybe determined by finding the maximum sample value I_(max)=max{I_(n):n=0,. . . N−1} and the minimum sample value I_(min)=min{I_(n):n=0, . . .N−1} in the N samples. The possible distinct data values {i_(l):l=0, . .. L−1} are then the range of data values from I_(min), to I_(max), i.e.,I_(min)≦i_(l)≦I_(max). The number of possible distinct data values L,i.e., the data value range, for the frame may be computed as thedifference between the maximum and minimum values of the N samples inthe frame, e.g., L=I_(max)−I_(min)+1. For example, if the actualdistinct sample values in the frame are {−3, −2, 0, 1, 2}, then L=6,indicating that there are six possible distinct data values in the frameand the possible distinct data values are {−3, −2, −1, 0, 1, 2, 3}.

A reference data value ν₀ is then determined from the possible distinctdata values i_(l) (204) and a coding order {ν_(k):k=1, . . . , L−1} ofthe L−1 remaining possible distinct data values is also determined(206). As is explained in more detail below, the reference data value ν₀and the coding order impact the decomposition of the N samples intocoding vectors, and thus the overall coding efficiency. That is, thecoding vectors, each of which represents locations of one of the L−1remaining possible distinct data values in the N samples, are generatedaccording to the coding order and this coding order may affect thecontent and length of the coding vectors. Further, as is explained inmore detail below, the reference data value and coding order, unlessfixed for all frames, are encoded in some fashion for communication tothe decoder. The selection of the reference data value and the codingorder affect how many bits are required for encoding.

The reference data value ν₀ may be any one of the possible distinct datavalues i_(l) and may be determined in any suitable way, e.g., a singleempirically determined value, direct computation, table look-up, etc.For example, the reference data value ν₀ may be the data value thatoccurs most frequently in the N samples, or, if the digital signal hascertain characteristics, may be set to 0 for all frames. The codingorder {ν_(k): k=1, . . . , L−1} of the L−1 remaining possible distinctdata values may be also be determined in any suitable way. In general,the L−1 remaining possible distinct data values are mapped in some wayto one of the ν_(k). For example, if the possible distinct data valuesare {−2,−1,0,1,2} and the reference data value ν₀=0, one possible codingorder is {−1,1,−2,2}. The technique(s) for determining the referencedata value ν₀ and the coding order ν_(k) may be defined by a particularapplication, resources available, known signal characteristics, and/orperformance required. Factors to be considered in the determination ofthe reference data value ν₀ and the coding order ν_(k) are discussedbelow.

One possible way to determine the reference data value ν₀ and/or thecoding order ν_(k) is to calculate the compression obtained for eachpossible reference data value and/or coding order of the L−1 remainingpossible data values and the corresponding coding vectors, and choose areference data value and/or the coding order that provides the bestcompression. However, this requires computational resources that may notbe available. In addition, this would require explicit encoding of thecoding order. Another possible way to determine the reference data valueν₀ and the coding order is to select the reference data value in somesuitable way and then use a specific pre-determined coding order, forexample from the minimum to the maximum data value of the remainingpossible data values. This does not require the computational resourcesmentioned above, and does not require explicitly encoding the codingorder. However, this approach may not provide the best overallcompression performance. Another possible way to determine the referencedata value ν₀ and the coding order is to select the most frequentlyoccurring data value in the N samples as the reference data value and toorder the L−1 remaining possible data values in order of frequency ofoccurrence. This also does not require the computational resources ofthe initial approach but it does require explicitly encoding thereference data value and the coding order. Again, this approach may notprovide the best overall compression performance.

In some embodiments of the invention, the reference data value ν₀ is setto the data value that occurs most often in the N samples. The codingorder ν_(k) of the L−1 remaining possible distinct data values isdetermined by comparing the total number of occurrences of actualdistinct data values in the N samples above the reference value ν₀,N_(A), to the total number of occurrences of values below the referencevalue ν₀, N_(B). The L−1 possible distinct data values are mapped to thecoding order ν_(k) by alternating above and below the reference datavalue ν₀ as follows:

$\begin{matrix}{{{if}\mspace{14mu} N_{A}} \geq N_{B}} & {{{if}\mspace{14mu} N_{A}} < N_{B}} \\{v_{1} = {v_{0} + 1}} & {v_{1} = {v_{0} - 1}} \\{v_{2} = {v_{0} - 1}} & {v_{2} = {v_{0} + 1}} \\{v_{3} = {v_{0} + 2}} & {v_{3} = {v_{0} - 2}} \\{v_{4} = {v_{0} - 2}} & {v_{4} = {v_{0} + 2}} \\\vdots & \vdots\end{matrix}$Assignment above and below the reference value ν₀ is done as long asdata values are available for alternating; any remaining data values arethen assigned to the remaining ν_(k).

For example, consider the example signal of FIG. 3A. In this signal,N=20, L=5, and the possible distinct data values are {−2,−1,0,1,2}. Themost frequently occurring data value is 0, so the reference data valueν₀ is set to 0. Further, N_(A)=7 and N_(B)=4. Since N_(A)>N_(B), thecoding order will be {1,−1,2,−2}. If this approach for determining thereference data value ν₀ and the coding order ν_(k) is used, theinformation to be encoded for the decoder is the reference data value ν₀and an indication of whether the first data value in the coding order isthe data value above or below the reference data value ν₀, e.g., asingle bit.

Referring again to FIG. 2, once the reference data value ν₀ and thecoding order are determined, the N samples are decomposed into L−1coding vectors based on the coding order where each coding vectoridentifies the locations of one of the L−1 remaining possible datavalues, i.e., the locations of one of the ν_(k), in the N samples (208).In some embodiments of the invention, the N samples are first decomposedinto L−1 interim coding vectors c_(k) with a 1 at locations where therespective ν_(k) value occurs and a 0 in all other locations. Theinterim coding vectors c_(k) are then processed to generatereduced-length coding vectors z_(k).

More specifically, the N samples, denoted as s, may be decomposed as

$s = {v_{0} + {\sum\limits_{k = 1}^{L - 1}{( {v_{k} - v_{0}} )c_{k}}}}$where the interim coding vectors c_(k) represent the locations of allvalues ν_(k) within the N samples. An interim coding vector c_(k)contains 1 at the locations at which the value ν_(k) occurs, and 0elsewhere. The number of occurrences of each ν_(k) value, N_(k), equalsthe number of non-zero elements in the corresponding c_(k) vector,

${N_{k} = {\sum\limits_{i = 1}^{N}{c_{k}(i)}}},{with}$$N_{0} = {N - {\sum\limits_{k = 1}^{L - 1}{N_{k}.}}}$To encode the N samples, it is sufficient to specify the number ofpossible data values L, the reference data value ν₀, and the codingorder ν_(k) with the corresponding interim coding vectors c_(k).

FIGS. 3A-3E show an example of a digital signal decomposition intointerim coding vectors c_(k). In the original digital signal of FIG. 3A,N=20, L=5, and the possible distinct data values are {−2,−1,0,1,2}. Forthe decomposition, the reference value ν₀=0, and the coding order isν₁=1, ν₂=−1, ν₃=2, and ν₄=−2. The corresponding interim coding vectorsc_(k) are shown in FIGS. 3B-3E.

The interim coding vectors c_(k) are then reduced in length to generatethe coding vectors z_(k). The approach to generating the coding vectorsz_(k) takes advantage of the fact that the interim coding vectors c_(k)contain non-zero elements in unique locations, i.e.,

-   -   if c_(k) (n)=1    -   then c_(l)(n)=0 for all l≠k        where n=1, . . . , N. Using this property, once a given interim        coding vector c_(k) is reduced to a coding vector z_(k), the        elements corresponding to the N_(k) non-zero c_(k) locations        need not be considered when reducing all subsequent interim        encoding vectors c_(i), i>k.

The coding vectors z_(k) may be generated from the interim codingvectors c_(k) as follows. Let z_(k) denote a vector obtained from thecode vector c_(k) by removing elements corresponding to allnon-zero-value locations in vectors c₁, . . . , c_(k-1) (or,equivalently, by preserving those elements corresponding to zero-valuelocations). The D_(k) dimension (length) of a vector z_(k) is given by

${D_{k} = {N - {\sum\limits_{i = 1}^{k - 1}N_{i}}}},{k = 2},\ldots\mspace{14mu},{L - 1.}$Let vectors δ_(k) specify the non-zero-value and zero-value locationsobserved in the interim coding vectors c₁, . . . , c_(k),

${{\delta_{k}(n)} = {\sum\limits_{i = 1}^{k}{c_{i}(n)}}},{k = 1},\ldots\mspace{14mu},{L - 1.}$Note that the vectors δ_(k) may be calculated recursively:δ₁(n)=c ₁(n)δ_(k)(n)=δ_(k-1)(n)+c _(k)(n),k=2, . . . ,L−1.

Further, letz ₁(n)=c ₁(n),n=1, . . . ,N,with the D₁ dimension equal to N. The coding vectors z_(k), k=2, . . . ,L−1, may be computed as follows:

-   -   set m=1    -   for each n=1, . . . , N        -   if δ_(k-1)(n)=0        -   then z_(k) (m)=c_(k) (n) and m=m+1            Note that the coding vectors z_(k), k=2, . . . , L−1 are            generated sequentially in the coding order. The resulting            coding vectors z_(k) are summarized in Table 1 below.

TABLE 1 Number of Coding vector elements Description z₁ N equivalent toc₁ z₂ N − N₁ c₂ with elements corresponding to non-zero locations in c₁removed z₃ N − N₁ − N₂ c₃ with elements corresponding to non-zerolocations in c₁ and c₂ removed . . . z_(L−1)$N - {\sum\limits_{i = 1}^{L - 2}N_{i}}$ c_(L−1) with elementscorresponding to non- zero locations in c₁, . . . , c_(L−2) removed

Note that as elements are removed from the interim coding vectors c_(k),the coding vectors become shorter with each processing step k whichhelps to improve coding efficiency. While the total number of elementsin the interim coding vectors c_(k) equals N(L−1), the total number ofelements in coding vectors z_(k) is reduced to

${{\sum\limits_{k = 1}^{L - 1}( {N - {\sum\limits_{i = 1}^{k - 1}N_{i}}} )} = {{N( {L - 1} )} - {\sum\limits_{k = 1}^{L - 2}{\sum\limits_{i = 1}^{k}N_{i}}}}},$i.e., reduced by

${\sum\limits_{k = 1}^{L - 2}{\sum\limits_{i = 1}^{k}N_{i}}} = {\sum\limits_{k = 1}^{L - 2}{N_{k}( {L - 1 - k} )}}$which is maximized when N₁≧N₂≧ . . . ≧N_(L-1).

FIGS. 4A-4D show an example of the generation of the L−1 reduced-lengthcoding vectors z_(k) from the interim coding vectors c_(k) of FIGS.3B-3E. The z₁ coding vector of FIG. 4A is equivalent to the interimcoding vector c₁ in FIG. 3B. The reduced-length coding vector z₂ of FIG.4B is formed by removing the five non-zero locations in c₁ from theinterim coding vector c₂ of FIG. 3C. The reduced-length vector z₃ ofFIG. 4C is then formed by removing the eight non-zero locations in c₁and c₂ from c₃ in FIG. 3D. This process continues until all L−1reduced-length coding vectors are generated. As such, due to the removalof non-zero elements in prior vectors, vectors z1 through z4 as shown inFIG. 4A-D may be decreasing in number of locations. Vectors z1 throughz4 also may have the locations renumbered so that they all start at 1and are sequential. Vector z1 may contain 20 locations. Vector c1, ofFIG. 3B, may contain five non-zero values, for example, at locations 1,7, 13, 17, and 18. Therefore, in such an embodiment, vector z2 willcontain 15 locations (i.e. locations 20−5). In one embodiment, Vector z2is formed by removing locations 1, 7, 13, 17, and 18 from c2, as shownin FIG. 3C. Thus, the reduced vector z2, shown in FIG. 4B, may consistof fifteen locations, i.e. 2-6, 8-12, 14-16, and 19-20 of vector c2.These locations may be renumbered such that vector z2 has locations1-15. To form vector z3, shown FIG. 4C, the non-zero locations ofvectors c1 and c2 may be removed from vector c3, of FIG. 3D. Sincevector c1 may have five non-zero values at locations, i.e. 1, 7, 13, 17,and 18, and since vector c2 may have three non-zero values at, i.e. 8,16, and 19, there will be eight (5+3) locations removed, and vector z3of FIG. 4C may have twelve (20−8) locations, consisting of the remaininglocations, i.e. 2-6, 9-12, 14-15, and 20. Vector z3 may be formed byselecting those remaining locations from vector c3, and renumbering thelocations. In such an embodiment, vector z3 would have locations 1-12.Vector z4 of FIG. 4D may be formed by removing the non-zero locations ofvectors c1, c2, and c3 from vector c4 of FIG. 3E. As such, vector c1 mayhave five non-zero values at locations, i.e. 1, 7, 13, 17, and 18, andsince vector c2 may have three non-zero values at, i.e. 8, 16, and 19,and since vector c3 may have two non-zero values at locations, i.e. 10and 15, there will be 10 (5+3+2) locations removed and vector z4 of FIG.4D may have ten (20−10) locations, consisting of the remaininglocations, i.e. 2-6, 9, 11-12, 14, and 20. Vector z4 may be formed byselection the remaining locations from vector c4 of FIG. 3E andrenumbering the locations to 1-10.

Referring again to FIG. 2, in some embodiments of the invention, as analternative to calculating interim coding vectors c_(k) and the codingvectors z_(k), the vector of the N samples is directly decomposed intoreduced-length coding vectors s_(k) computed as follows. Let s₁=s; thereduced-length coding vectors s_(k), k=2, . . . , L−1, may be computedas follows:

-   -   set m=1    -   for each n=1, . . . , D_(k-1)        -   if s_(k-1)(n)≠ν_(k-1)        -   then s_(k)(m)=s_(k-1)(n) and m=m+1            Note that the reduced-length coding vectors z_(k) and the            reduced-length coding vectors s_(k) have the same length,            D_(k), and that the locations in the coding vectors z_(k)            which contain 1 are the locations in the coding vectors            s_(k) which contain ν_(k). Thus, encoding the locations of            the ν_(k) values in the coding vectors s_(k) is equivalent            to encoding the locations of 1's in the coding vectors            z_(k).

The resulting coding vectors, i.e., the coding vectors z_(k) or thecoding vectors s_(k) are then encoded along with an appropriateindication of the reference data value ν₀ and the coding order used ingenerating the coding vectors (210) and inserted into the output bitstream. Any suitable encoding technique may be used to encode the codingvectors. Further, an encoding technique may be selected for each codingvector. That is, several encoding techniques may be available for useand the encoding technique that provides the best compression for aparticular coding vector may be selected for that coding vector. Forexample, the coding vectors z_(k) contain a series of zeros and ones,and there are many known techniques for encoding such vectors, such asrun-length coding methods like Golomb or Rice encoding. However, for aparticular coding vector z_(k), run-length coding may not be optimum.When the number of non-zero elements N_(k) is small, explicit encodingof the N_(k) locations may result in a fewer number of bits. In thisencoding technique, the number of non-zero locations N_(k) and thelocations themselves may be encoded using binary representation or otherknown pulse-coding techniques. In other cases, N_(k) may be such thatencoding z_(k) (n) as binary bits may be more efficient than eitherrun-length or explicit location encoding. Accordingly, the technique(s)used to encode the coding vectors z_(k) may be defined by a particularapplication, resources available, signal characteristics and performancerequired.

In some embodiments of the invention, three encoding techniques areprovided to be selected for encoding the coding vectors z_(k), Ricerun-length encoding, explicit location encoding, and binary encoding.Further, whenever for some k there are no occurrences of a particularvalue ν_(k), an indicator of a zero vector, z_(k)=0, is encoded in theoutput bit stream. The Rice run-length method encodes the length ofsegments between the occurrences of ones in a coding vector z_(k) (whichin essence defines the locations of all occurrences of a value ν_(k)).Compression is maximized by determining the Rice exponent for each z_(k)to be encoded. The Rice exponent is the power of two used in the Ricerun-length encoding technique. In one or more embodiments, a search forthe best exponent in the range of one to four is performed, and theexponent that provides the best compression is selected. The selectedRice exponent is encoded in the bit stream followed by the run-lengthencoding of the coding vector z_(k).

Explicit location encoding may be used to improve compression when thenumber of non-zero elements N_(k) in a coding vector z_(k) is small. Inthis case, compression may be achieved by a straightforward encoding ofa location offset within the coding vector. In one or more embodiments,if N_(k)≦4, explicit location encoding is used. In this case, the numberof locations N_(k) is encoded in the output bit stream followed by theoffsets of each of the locations. Since the length of a coding vectorz_(k) is D_(k), binary encoding of each location may be done in┌log₂(D_(k))┐ bits. In some embodiments of the invention, if the numberof bits needed to run length encode a coding vector z_(k) is greaterthan D_(k), binary encoding is used. The binary coding technique writesthe D_(k) bits of the coding vector z_(k) into the output bit stream.For each of these encoding techniques, an identifier of the selectedencoding technique is also inserted in the output bit stream prior tothe encoding bits of the coding vector z_(k).

In some embodiments of the invention, three encoding techniques areprovided to be selected for encoding the coding vectors s_(k), Ricerun-length encoding (with four possible exponents), explicit locationencoding, and binary encoding. Further, whenever for some k there are nooccurrences of a particular value ν_(k), an indicator of a zero vector,z_(k)=0, is encoded in the output bit stream. One possible indicator ofa zero vector is shown in Table 2 below. When one of these codingtechniques is selected for encoding a coding vector s_(k), an indicatorof the selected coding technique is inserted in the output bit streamprior to the encoding bits of the coding vector s_(k). One set ofpossible indicators for the coding techniques is shown in Table 2 below.

TABLE 2 Bit stream Encoding sequence Binary encoding 000 Run length Riceencoding (S = 1) 001 Run length Rice encoding (S = 2) 010 Run lengthRice encoding (S = 3) 011 Run length Rice encoding (S = 4) 100 Value notoccurring 101 Unused 110 Explicit location encoding 111

In some embodiments of the invention, if the number of bits needed torun-length encode the locations of ν_(k) in a coding vector s_(k) isgreater than D_(k), then binary encoding is used. Specifically, D_(k)bits are written into the output bit stream, where binary 1's and 0'sare written when s_(k)(n)=ν_(k) and s_(k)(n)≠ν_(k), respectively, withn=0, . . . , D_(k)−1.

In some embodiments of the invention, Rice run length encoding is usedto encode the locations of ν_(k) in a coding vector s_(k) if the numberof bits required to encode the segment lengths between the occurrencesof ν_(k) within the s_(k)(n) sequence (which in essence defines thelocations of all occurrences of values ν_(k) provides the bestcompression. Rice parameters over the range of one to four are tried,and the one that provides the best compression is selected. If Rice runlength coding provides the best compression, then the coding vectors_(k) is run length encoded in the output bit stream.

In some embodiments of the invention, if binary encoding is not used and1≦N_(k)≦4 and the number of bits needed to run-length encode thelocations of ν_(k) a coding vector s_(k) is greater thanN_(k)┌log₂(D_(k))┐+2, then explicit location encoding is used. The N_(k)locations l_(k)(m) of ν_(k) are determined such thats_(k)(l_(k)(m))=ν_(k), for m=0, . . . , N_(k)−1. The binary value ofN_(k)−1 is encoded in the output bit stream in two bits and then theN_(k) indices l_(k)(m) are written to the output bit stream with┌log₂(D_(k))┐ bits each.

Referring again to FIG. 2, the steps 200-210 are repeated (212) for eachframe in the digital signal that is to be encoded using losslessvalue-location encoding. As is explained in more detail below inreference to FIG. 5, lossless value-location encoding may be used incombination with other methods for compressing digital signals. In suchembodiments, the lossless value-location encoding may be selected forencoding some frames in the digital signal and other encoding methodsmay be used for other frames in the digital signal. Criteria fordetermining when lossless value-location encoding is used in preferenceto other coding methods may depend on the application. For example,lossless value-location encoding may be used whenever the number ofpossible distinct data values to encode, L, is within some desiredrange, or when the minimum and maximum values of a frame are within adesired range, or whenever else the signal is expected to be efficientlyencoded by this method.

In some embodiments of the invention, lossless value-location encodingis selected according to criteria empirically determined by statisticalanalysis of relevant test signals. More specifically, losslessvalue-location encoding is used when L≦4 and the maximum and minimumdata values are in one of four desired ranges. The frame length N isalso considered for one of the four desired ranges. Table 3 belowsummarizes these selection criteria. If the data values in the framemeet one of the criteria in specified Table 3 and the most frequentlyoccurring data value in the frame is 0, then lossless value-locationencoding is used for the frame with the reference data value ν₀=0. Iflossless value-location encoding is used, an indicator of the specificcriteria met is written into the output stream, i.e., one of the valuesin the column of Table 3 labeled “Bit stream sequence.”

TABLE 3 Data- Bit Frame range stream L I_(min) I_(max) length casesequence 4 −2 1 240, 320 0 00 3 −1 1 All 1 01 3 −2 0 All 2 10 2 0 1 All3 11

In the above method, the mapping of the possible distinct data values tothe coding order ν_(k) impacts the achievable maximum compression of theN samples. Encoding a vector first that has a larger number of elementsN_(k) may require more bits to encode the locations of the ν_(k), butmore elements may be removed in the generation of subsequent codingvectors. On the other hand, encoding a coding vector with a smallernumber of elements before one with a larger number of elements mayrequire fewer bits, but fewer elements may be removed in the generationof subsequent coding vectors.

Further, the value determined for the reference data value ν₀ and/or thecoding order ν_(k) affects the achievable maximum compression. Forexample, some choices of the reference data value ν₀ and the codingorder ν_(k) may required the explicit encoding of the reference datavalue and each of the ν_(k). If B_(v), bits are required to encode onevalue, then LB, bits are needed to encode the ν₀ and ν_(k) values. Ifthe values in the frame are such that values are within some smalloffset of a particular value of ν₀ and B_(o) bits are required tospecify this offset, with B_(o)<B_(v), then the ν₀ and the ν_(k) offsetsmay be encoded in B_(v)+(L−1)B_(o), bits.

Encoding efficiency may be further improved if a known relationshipbetween the ν_(k) values exists, so that mapping of the remainingpossible data values to the ν_(k) may be done in a pre-determined order.For example, if the ν₀ and ν_(k) values are mapped sequentially from theminimum to maximum data values, then ν₀ may be encoded with all otherν_(k) being explicitly known. In general, it is desirable that thechoice of the reference data value ν₀ and the coding order ν_(k) is madesuch that when combined with encoding of the code vectors, maximumcoding efficiency is achieved.

FIG. 5 shows a block diagram of an audio encoder (500), e.g., the audioencoder (106) of FIG. 1, configured to perform lossless value-locationencoding in accordance with one or more embodiments of the invention.More specifically, FIG. 5 shows a high level block diagram of the ITU-TG.711.0 audio encoder for illustrative purposes. The audio encoder (500)includes a frame buffer (502), two coding tool selection components(504, 506), twelve coding tools, and a multiplexer (508). The audioencoder (500) receives G.711 audio frames in the frame buffer (502). Theframe size N may be 40, 80, 160, 240, or 320 samples. Each frame is thenprovided to input selection component (504).

The input selection component (504) may select one of seven encodingtools, i.e., the three constant coding tools, the PM zero Rice codingtool, the binary coding tool, the pulse mode coding tool, and thevalue-location coding tool, to which it is connected for encoding theframe based on an analysis of the audio frame and/or determine that theframe should be encoded by one of the five other coding tools, i.e., themapped domain LP coding tool, the fractional-bit coding tool, themin-max level coding tool, the direct LP coding tool, and theuncompressed coding tool. The outputs of the latter five coding toolsare provided to output selection component (506) which selects the bestoutput of the five coding tools by analyzing the results of the codingtools. The output selection component (506) may not require a completeencoding by each of the five coding tools, but rather may estimate theresulting encoded frame sizes and select one of the coding tools forperforming the actual encoding based on the estimates. The multiplexer(508) selects which coding tool bit stream to output: the bit stream ofthe coding tool selected by the input selection component (504) or thebit stream of the coding tool selected by the output selection component(506).

The coding techniques provided by each of the coding tools are describedin ITU-T G.711.0. Further, the fractional-bit coding tool may provide acoding technique as described in co-pending U.S. patent application Ser.No. 12/818,164, entitled “Method and System for Block AdaptiveFractional-Bit Per Sample Encoding, filed on Jun. 18, 2010, which isincorporated by reference herein in its entirety. The coding techniquedescribed in ITU-T G.711.0 for the value-location coding tool is anembodiment of the method for lossless value-location encoding of FIG. 2.In the described embodiment, the value-location coding tool is selectedaccording to the criteria shown in Table 3 above and when the mostfrequently occurring data value in a frame is 0. When selected, thevalue-location coding tool assumes that the reference data value ν₀ is 0and determines the coding order ν_(k) using the previously describingalternating technique. Further, the N samples in the frame aredecomposed into coding vectors s_(k) as previously described, and areselectively encoded using one of Rice run-length encoding, explicitlocation encoding, or binary encoding as previously described.

In one or more embodiments of the invention, the value-location codingtool may provide coding functionality in accordance with one or moreother embodiments of the method of FIG. 2. For example, interim codingvectors c_(k) may be computed and then reduced in length to generatereduced-length coding vectors z_(k). Further, different techniques maybe used to determine the reference data value ν₀ and/or the coding orderν_(k).

Embodiments of the methods and encoders described herein may beimplemented in hardware, software, firmware, or any combination thereof.If implemented in software, the software may be executed in one or moreprocessors, such as a microprocessor, application specific integratedcircuit (ASIC), field programmable gate array (FPGA), or digital signalprocessor (DSP). Any included software may be initially stored in acomputer-readable medium such as compact disc (CD), a diskette, a tape,a file, memory, or any other computer readable storage device and loadedand executed in the processor. In some cases, the software may also besold in a computer program product, which includes the computer-readablemedium and packaging materials for the computer-readable medium. In somecases, the software instructions may be distributed via removablecomputer readable media (e.g., floppy disk, optical disk, flash memory,USB key), via a transmission path from computer readable media onanother digital system, etc.

Embodiments of the methods and encoders for lossless value-locationencoding as described herein may be implemented for virtually any typeof digital system (e.g., a desk top computer, a laptop computer, ahandheld device such as a mobile (i.e., cellular) phone, a personaldigital assistant, a Voice over Internet Protocol (VOIP) communicationdevice such as a telephone, server or personal computer, etc.) withfunctionality to capture or otherwise generate digital signals. FIG. 6shows a block diagram of an illustrative digital system (600) (e.g., apersonal computer) that includes a processor (602), associated memory(604), a storage device (606), and numerous other elements andfunctionalities typical of digital systems (not shown). In one or moreembodiments of the invention, the digital system (600) may includemultiple processors and/or one or more of the processors may be digitalsignal processors.

The digital system (600) may also include input means, such as akeyboard (608) and a mouse (610) (or other cursor control device), andoutput means, such as a monitor (612) (or other display device). Thedigital system (600) may also include an audio capture device (notshown) that includes circuitry (e.g., a microphone) for capturing audiosequences. The digital system (600) may include an audio encoder, e.g.,the encoder of FIG. 5, with functionality to perform embodiments of themethod of FIG. 2 as described herein. The digital system (600) may beconnected to a network (not shown) (e.g., a local area network (LAN), awide area network (WAN) such as the Internet, a cellular network, anyother similar type of network and/or any combination thereof) via anetwork interface connection (not shown). Those skilled in the art willappreciate that the input and output means may take other forms.

Further, those skilled in the art will appreciate that one or moreelements of the aforementioned digital system (600) may be located at aremote location and connected to the other elements over a network.Further, embodiments of the invention may be implemented on adistributed system having a plurality of nodes, where each portion ofthe system and software instructions may be located on a different nodewithin the distributed system. In one embodiment of the invention, thenode may be a digital system. Alternatively, the node may be a processorwith associated physical memory. The node may alternatively be aprocessor with shared memory and/or resources.

Software instructions to perform embodiments of the invention may bestored on a computer readable medium such as a compact disc (CD), adiskette, a tape, a file, memory, or any other computer readable storagedevice. The software instructions may be distributed to the digitalsystem (600) via removable computer readable media (e.g., floppy disk,optical disk, flash memory, USB key), via a transmission path fromcomputer readable media on another digital system, etc.

While the invention has been described with respect to a limited numberof embodiments, those skilled in the art, having benefit of thisdisclosure, will appreciate that other embodiments can be devised whichdo not depart from the scope of the invention as disclosed herein.Accordingly, the scope of the invention should be limited only by theattached claims. It is therefore contemplated that the appended claimswill cover any such modifications of the embodiments as fall within thetrue scope and spirit of the invention.

What is claimed is:
 1. A method of encoding samples in a digital signal,the method comprising: receiving a frame of N samples of the digitalsignal; determining L possible distinct data values in the N samples;determining a reference data value in the L possible distinct datavalues and a coding order of L−1 remaining possible distinct datavalues, wherein each of the L−1 remaining possible distinct data valuesis mapped to a position in the coding order; decomposing the N samplesinto L−1 coding vectors based on the coding order, wherein each codingvector identifies the locations of one of the L−1 remaining possibledistinct data values in the N samples, wherein decomposing the N samplescomprises computing L−1 interim coding vectors based on the codingorder, wherein an interim coding vector includes a first value atlocations where the one of the L−1 remaining possible distinct datavalues occurs and a second value in all other locations and computingthe L−1 coding vectors in the coding order from the L−1 interim codingvectors.
 2. The method of claim 1, wherein a coding vector of the L−1coding vectors is equivalent to an interim coding vector of the L−1interim coding vectors with data values corresponding to locationshaving the first value in at least one previous interim coding vectorremoved.
 3. The method of claim 1, wherein decomposing the N samplescomprises: computing L−1 coding vectors, wherein an initial codingvector of the L−1 coding vectors consists of the N samples, and asubsequent coding vector of the L−1 coding vectors is generated byremoving all occurrences of one or more data values in the coding orderfrom the initial coding vector.
 4. The method of claim 1, wherein thecoding order is determined by alternating assignment of the L−1remaining possible data values to the coding order based on whether aremaining possible data value is above or below the reference datavalue.
 5. The method of claim 4, wherein the reference data value is 0.6. The method of claim 1, wherein encoding the L−1 coding vectorscomprises selecting an encoding technique for at least one of the L−1coding vectors.
 7. The method of claim 6, wherein the encoding techniqueis one selected from a group consisting of Rice run-length encoding,explicit location encoding, and binary encoding.
 8. The method of claim1, wherein encoding the L−1 coding vectors comprises encoding anindicator when a possible distinct data value in the L possible distinctdata values is not found in the N samples.
 9. An encoder for encoding adigital signal, the encoder comprising: a frame buffer configured toreceive a frame of N samples of the digital signal; and a value-locationcoding component implemented in a hardware configured to encode theframe by determining L possible distinct data values in the N samples;determining a reference data value in the L possible distinct datavalues and a coding order of L−1 remaining possible distinct datavalues, wherein each of the L−1 remaining possible distinct data valuesis mapped to a position in the coding order; decomposing the N samplesinto L−1 coding vectors based on the coding order, wherein each codingvector identifies the locations of one of the L−1 remaining possibledistinct data values in the N samples; encoding the L−1 coding vectors;and wherein the value-location coding component is further configured todecompose the N samples by computing L−1 interim coding vectors based onthe coding order, wherein an interim coding vector includes a firstvalue at locations where the one of the L−1 remaining possible distinctdata values occurs and a second value in all other locations andcomputing the L−1 coding vectors in the coding order from the L−1interim coding vectors.
 10. The encoder of claim 9, wherein a codingvector of the L−1 coding vectors is equivalent to an interim codingvector of the L−1 interim coding vectors with data values correspondingto locations having the first value in at least one previous interimcoding vector removed.
 11. The encoder of claim 9, wherein thevalue-location coding component is further configured to decompose the Nsamples by computing L−1 coding vectors, wherein an initial codingvector of the L−1 coding vectors consists of the N samples, and asubsequent coding vector of the L−1 coding vectors is generated byremoving all occurrences of one or more data values in the coding orderfrom the initial coding vector.
 12. The encoder of claim 9, wherein thecoding order is determined by alternating assignment of the L−1remaining possible data values to the coding order based on whether aremaining possible data value is above or below the reference datavalue.
 13. The encoder of claim 9, wherein the value-location codingcomponent is configured to encode the L−1 coding vectors by selecting anencoding technique from a plurality of encoding techniques for at leastone of the L−1 coding vectors, wherein the plurality of encodingtechniques comprises Rice run-length encoding, explicit locationencoding, and binary encoding.
 14. A digital system configured to encodesamples in a digital signal, the digital system comprising: means forreceiving a frame of N samples of the digital signal; means fordetermining L possible distinct data values in the N samples; means fordetermining a reference data value in the L possible distinct datavalues and a coding order of L−1 remaining possible distinct datavalues, wherein each of the L−1 remaining possible distinct data valuesis mapped to a position in the coding order; means for decomposing the Nsamples into L−1 coding vectors based on the coding order, wherein eachcoding vector identifies the locations of one of the L−1 remainingpossible distinct data values in the N samples, wherein the means fordecomposing the N samples is configured to compute L−1 interim codingvectors based on the coding order, wherein an interim coding vectorincludes a first value at locations where the one of the L−1 remainingpossible distinct data values occurs and a second value in all otherlocations and compute the L−1 coding vectors in the coding order fromthe L−1 interim coding vectors; and means for encoding the L−1 codingvectors.
 15. The digital system of claim 14, wherein the means fordecomposing the N samples is configured to compute L−1 coding vectors,wherein an initial coding vector of the L−1 coding vectors consists ofthe N samples, and a subsequent coding vector of the L−1 coding vectorsis generated by removing all occurrences of one or more data values inthe coding order from the initial coding vector.
 16. The digital systemof claim 14, wherein the coding order is determined by alternatingmapping of the L−1 remaining possible data values to positions in thecoding order based on whether a remaining possible data value is aboveor below the reference data value.
 17. The digital system of claim 14,wherein the means for encoding is configured to encode the L−1 codingvectors by selecting an encoding technique from a plurality of encodingtechniques for each of the L−1 coding vectors.